<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理后台</title>
    <link rel="stylesheet" href="/static/lib/layui/css/layui.css">
    {block name="css"}{/block}
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo" style="background: #393D49;border-bottom: 1px solid #393D49;">{$sysInfo.name}</div>
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a href="{:url('admin/home/home')}" target="main" class="layui-icon layui-icon-home"></a></li>
            <li class="layui-nav-item"><a href="javascript:void(0);" id="open_menu" class="layui-icon layui-icon-spread-left"></a></li>
            <li class="layui-nav-item"><a href="javascript:void(0);" id="clear_cache" class="layui-icon layui-icon-fonts-clear"></a></li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">你好,{$adminInfo.name}</a>
            </li>
            <li class="layui-nav-item"><a href="#" id="logout"  class="layui-icon layui-icon-close" title="退出登录"></a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree" id="menu">
                {volist name="menuList" id="vo"}
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon {$vo.icon}"></i>  {$vo.title}</a>
                    <dl class="layui-nav-child">
                        {volist name="vo.child" id="child"}
                        <dd><a  href="{:url($child.name)}" target="main">{$child.title}</a></dd>
                        {/volist}
                    </dl>
                </li>
                {/volist}
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <iframe src="{:url('admin/home/home')}" name="main" width="100%" height="100%" style="border:none;display:block;"></iframe>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © 2019  版权所有
    </div>
</div>

<script src="/static/lib/layui/layui.js"></script>
<script>
    layui.use(['layer', 'element'], function () {
        var layer = layui.layer;
        var $ = layui.jquery;
        var is_open = 0;
        // 折叠打开菜单
        $("#open_menu").click(function () {
            if (is_open) {
                $("#menu .layui-nav-item").removeClass("layui-nav-itemed");
                is_open = 0;
            } else {
                $("#menu .layui-nav-item").addClass("layui-nav-itemed");
                is_open = 1;
            }
            return false;
        });

        // 清除缓存
        $("#clear_cache").click(function () {
            $.ajax({
                url: "{:url('admin/login/clearCache')}",
                type: "post",
                dataType: "json",
                success: function (ret) {
                    layer.msg(ret.msg);
                }
            });
            return false;
        });

        // 注销登录
        $("#logout").click(function () {
            $.ajax({
                url: "{:url('admin/login/logout')}",
                type: "post",
                dataType: "json",
                success: function (ret) {
                    layer.msg(ret.msg, {time: 2000}, function () {
                        location.href = "{:url('admin/login/login')}";
                    });
                }
            });
            return false;
        });
    });
</script>
</body>
</html>